﻿<%@ Page Language="C#" MasterPageFile="../main.master" Inherits="VioletDevelopmentLaboratory.Net.Web.Configuration.VWebConfigManagerPage" %>

<script runat="server">
	protected void ModeDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);
	}

	
	
	
	
	
	
	protected void FormsDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);
	}

	
	
	
	
	
	protected void CredentialsDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);
	}







	protected void UsersGridView_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
	{
		UsersDetailsView.ChangeMode(DetailsViewMode.ReadOnly);
	}
	protected void UsersDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
	{
		ShowAlert_DetailsView_ItemInserted(e);

		UsersGridView.SelectedIndex = -1;
		UsersGridView.DataBind();
	}
	protected void UsersDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);

		UsersGridView.SelectedIndex = -1;
		UsersGridView.DataBind();
	}
	protected void UsersDetailsView_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
	{
		ShowAlert_DetailsView_ItemDeleted(e);

		UsersDetailsView.ChangeMode(DetailsViewMode.Insert);
		
		UsersGridView.SelectedIndex = -1;
		UsersGridView.DataBind();
	}


	
	
	
	
	
	
	
	protected void PassportDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);
	}
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPlaceHolder" runat="server">
	<h2>Authentication</h2>

	<div>
		<asp:ObjectDataSource ID="ModeDetailsViewDataSource" runat="server" 
			SelectMethod="GetAuthenticationSection" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.AuthenticationSectionManager" 
			UpdateMethod="ModifyMode">
			<UpdateParameters>
				<asp:Parameter Name="mode" Type="Object" />
			</UpdateParameters>
		</asp:ObjectDataSource>
		<fieldset>
			<legend>authentication</legend>
			<asp:DetailsView ID="ModeDetailsView" runat="server" AutoGenerateRows="False" 
			CellPadding="5" DataSourceID="ModeDetailsViewDataSource" DefaultMode="Edit" 
				onitemupdated="ModeDetailsView_ItemUpdated">
			<Fields>
				<asp:TemplateField HeaderText="Mode">
					<EditItemTemplate>
						<asp:DropDownList ID="ModeDropDownList" runat="server" SelectedValue='<%# Bind("Mode") %>'>
							<asp:ListItem>None</asp:ListItem>
							<asp:ListItem>Forms</asp:ListItem>
							<asp:ListItem>Passport</asp:ListItem>
							<asp:ListItem>Windows</asp:ListItem>
						</asp:DropDownList>
					</EditItemTemplate>
				</asp:TemplateField>
				<asp:CommandField ButtonType="Button" ShowEditButton="True" 
					ShowCancelButton="False" />
			</Fields>
		</asp:DetailsView>
		</fieldset>
	</div>

	<div style="margin-left : 30px">
		<asp:ObjectDataSource ID="FormsDetailsViewDataSource" runat="server" 
			SelectMethod="GetForms" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.AuthenticationSectionManager" 
			UpdateMethod="ModifyForms">
			<UpdateParameters>
				<asp:Parameter Name="cookieless" Type="Object" />
				<asp:Parameter Name="defaultUrl" Type="String" />
				<asp:Parameter Name="domain" Type="String" />
				<asp:Parameter Name="enableCrossAppRedirects" Type="Boolean" />
				<asp:Parameter Name="loginUrl" Type="String" />
				<asp:Parameter Name="name" Type="String" />
				<asp:Parameter Name="path" Type="String" />
				<asp:Parameter Name="protection" Type="Object" />
				<asp:Parameter Name="requireSsl" Type="Boolean" />
				<asp:Parameter Name="slidingExpiration" Type="Boolean" />
				<asp:Parameter Name="timeout" Type="Object" />
			</UpdateParameters>
		</asp:ObjectDataSource>
		<fieldset>
			<legend>forms</legend>
			<asp:DetailsView ID="FormsDetailsView" runat="server" AutoGenerateRows="False" 
				DataSourceID="FormsDetailsViewDataSource" DefaultMode="Edit" CellPadding="5" 
				onitemupdated="FormsDetailsView_ItemUpdated">
				<Fields>
					<asp:TemplateField HeaderText="Cookieless" SortExpression="Cookieless">
						<EditItemTemplate>
							<asp:DropDownList ID="CookielessDropDownList" runat="server" 
								SelectedValue='<%# Bind("Cookieless") %>'>
								<asp:ListItem>UseCookies</asp:ListItem>
								<asp:ListItem>UseUri</asp:ListItem>
								<asp:ListItem>AutoDetect</asp:ListItem>
								<asp:ListItem>UseDeviceProfile</asp:ListItem>
							</asp:DropDownList>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:BoundField DataField="DefaultUrl" HeaderText="DefaultUrl" 
						SortExpression="DefaultUrl" />
					<asp:BoundField DataField="Domain" HeaderText="Domain" 
						SortExpression="Domain" />
					<asp:CheckBoxField DataField="EnableCrossAppRedirects" 
						HeaderText="EnableCrossAppRedirects" SortExpression="EnableCrossAppRedirects" />
					<asp:BoundField DataField="LoginUrl" HeaderText="LoginUrl" 
						SortExpression="LoginUrl" />
					<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
					<asp:BoundField DataField="Path" HeaderText="Path" SortExpression="Path" />
					<asp:TemplateField HeaderText="Protection" SortExpression="Protection">
						<EditItemTemplate>
							<asp:DropDownList ID="ProtectionDropDownList" runat="server" 
								SelectedValue='<%# Bind("Protection") %>'>
								<asp:ListItem>All</asp:ListItem>
								<asp:ListItem>Encryption</asp:ListItem>
								<asp:ListItem>None</asp:ListItem>
								<asp:ListItem>Validation</asp:ListItem>
							</asp:DropDownList>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:CheckBoxField DataField="RequireSSL" HeaderText="RequireSSL" 
						SortExpression="RequireSSL" />
					<asp:CheckBoxField DataField="SlidingExpiration" HeaderText="SlidingExpiration" 
						SortExpression="SlidingExpiration" />
					<asp:BoundField DataField="Timeout" HeaderText="Timeout" 
						SortExpression="Timeout" />
					<asp:CommandField ButtonType="Button" ShowCancelButton="False" 
						ShowEditButton="True" />
				</Fields>
			</asp:DetailsView>
		</fieldset>
	</div>

	<div style="margin-left : 60px">
		<asp:ObjectDataSource ID="CredentialsDetailsViewDataSource" runat="server" 
			SelectMethod="GetFormsCredentials" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.AuthenticationSectionManager" 
			UpdateMethod="ModifyFormsCredentials">
			<UpdateParameters>
				<asp:Parameter Name="passwordFormat" Type="Object" />
			</UpdateParameters>
		</asp:ObjectDataSource>
		<fieldset>
			<legend>credentials</legend>
			<asp:DetailsView ID="CredentialsDetailsView" runat="server" 
				AutoGenerateRows="False" CellPadding="5" 
				DataSourceID="CredentialsDetailsViewDataSource" DefaultMode="Edit" 
				onitemupdated="CredentialsDetailsView_ItemUpdated">
				<Fields>
					<asp:TemplateField HeaderText="PasswordFormat" SortExpression="PasswordFormat">
						<EditItemTemplate>
							<asp:DropDownList ID="PassowrdFormatDropDownList" runat="server" 
								SelectedValue='<%# Bind("PasswordFormat") %>'>
								<asp:ListItem>Clear</asp:ListItem>
								<asp:ListItem>MD5</asp:ListItem>
								<asp:ListItem>SHA1</asp:ListItem>
							</asp:DropDownList>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:CommandField ButtonType="Button" ShowCancelButton="False" 
						ShowEditButton="True" />
				</Fields>
			</asp:DetailsView>
		</fieldset>
	</div>

	<div style="margin-left : 90px">
		<asp:ObjectDataSource ID="UsersDetailsViewDataSource" runat="server" 
			DeleteMethod="RemoveFormsCredentialsUser" 
			InsertMethod="AddFormsCredentialsUser" SelectMethod="GetFormsCredentialsUser" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.AuthenticationSectionManager" 
			UpdateMethod="ModifyFormsCredentialsUser">
			<DeleteParameters>
				<asp:Parameter Name="name" Type="String" />
			</DeleteParameters>
			<UpdateParameters>
				<asp:Parameter Name="name" Type="String" />
				<asp:Parameter Name="password" Type="String" />
			</UpdateParameters>
			<SelectParameters>
				<asp:ControlParameter ControlID="UsersGridView" Name="name" 
					PropertyName="SelectedValue" Type="String" />
			</SelectParameters>
			<InsertParameters>
				<asp:Parameter Name="name" Type="String" />
				<asp:Parameter Name="password" Type="String" />
			</InsertParameters>
		</asp:ObjectDataSource>
		<asp:ObjectDataSource ID="UsersGridViewDataSource" runat="server" 
			SelectMethod="GetFormsCredentialsUserCollection" 
			
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.AuthenticationSectionManager">
		</asp:ObjectDataSource>
		<fieldset>
			<legend>users</legend>
			<asp:DetailsView ID="UsersDetailsView" runat="server" AutoGenerateRows="False" 
				CellPadding="5" DataKeyNames="Name" DataSourceID="UsersDetailsViewDataSource" 
				DefaultMode="Insert" oniteminserted="UsersDetailsView_ItemInserted" 
				onitemupdated="UsersDetailsView_ItemUpdated" 
				onitemdeleted="UsersDetailsView_ItemDeleted">
				<Fields>
					<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" 
						SortExpression="Name" />
					<asp:BoundField DataField="Password" HeaderText="Password" 
						SortExpression="Password" />
					<asp:CommandField ButtonType="Button" ShowDeleteButton="True" 
						ShowEditButton="True" ShowInsertButton="True" />
				</Fields>
			</asp:DetailsView>
			<asp:GridView ID="UsersGridView" runat="server" AutoGenerateColumns="False" 
				CellPadding="5" DataKeyNames="Name" DataSourceID="UsersGridViewDataSource" 
				onselectedindexchanging="UsersGridView_SelectedIndexChanging">
				<Columns>
					<asp:CommandField ShowSelectButton="True" />
					<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" 
						SortExpression="Name" />
					<asp:BoundField DataField="Password" HeaderText="Password" 
						SortExpression="Password" />
				</Columns>
			</asp:GridView>
		</fieldset>
	</div>

	<div style="margin-left : 30px">
		<asp:ObjectDataSource ID="PassportDetailsViewDataSource" runat="server" 
			SelectMethod="GetPassportAuthentication" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.AuthenticationSectionManager" 
			UpdateMethod="ModifyPassport">
			<UpdateParameters>
				<asp:Parameter Name="redirectUrl" Type="String" />
			</UpdateParameters>
		</asp:ObjectDataSource>
		<fieldset>
			<legend>passport</legend>
			<asp:DetailsView ID="PassportDetailsView" runat="server" AutoGenerateRows="False" 
				CellPadding="5" DataSourceID="PassportDetailsViewDataSource" DefaultMode="Edit" 
				onitemupdated="PassportDetailsView_ItemUpdated">
				<Fields>
					<asp:BoundField DataField="RedirectUrl" HeaderText="RedirectUrl" 
						SortExpression="RedirectUrl" />
					<asp:CommandField ButtonType="Button" ShowCancelButton="False" 
						ShowEditButton="True" />
				</Fields>
			</asp:DetailsView>
		</fieldset>
	</div>
</asp:Content>